package org.honeyweb.gsoc.dao;

import org.honeyweb.gsoc.model.Users;

public interface UsersDao {

    /**
     * Check if the login exists and if the password is correct in datasource. 
     * @param login : user login
     * @param password : user password
     * @return true if the login exists and if the password is correct. 
     * Otherwise, return false. 
     * @throws DataAccessException in case of Data access errors 
     * (database unreachable, etc.)
     */
    public boolean checkLogin (String login, String password);

    /**
     * Return a User object from a given login.
     * @param login : user login
     * @return the corresponding user object.
     * @throws DataAccessException in case of Data access errors 
     * (database unreachable, etc.)
     */
    public Users getUser(String login);
    
    
    /**
     * persist a User object from a form.
     * @param login : user login
     * @param password : user password
     * @return the corresponding user object.
     * @throws DataAccessException in case of Data access errors 
     * (database unreachable, etc.)
     */
    public void addUser(Users user);
    
    /**
     * update a User organizatioId.
     * @param organizationsId : int
     * @param id : int (id of the user to update)
     * @throws DataAccessException in case of Data access errors 
     * (database unreachable, etc.)
     */
    public void updateUserOrganizationsId(int organizationsId, int id);
    
    /**
     * get an admin of an organization
     * @param adminId
     * @return the corresponding user object.
     * @throws DataAccessException in case of Data access errors 
     * (database unreachable, etc.)
     */
    public Users getAdmin(int adminId);

    /**
     * update a User.
     * @throws DataAccessException in case of Data access errors 
     * (database unreachable, etc.)
     */
    public void updateUser(String login, String firstName, String lastName, String mail,int id);

}
